%Macro Manip;
Data one; set one;
retain insectno2;
if insectno2<1 then insectno2=0;
insectno2=insectno2+1;
Data two three; set one;
if mod(insectno2,2) eq 1 then output two;
if mod(insectno2,2) eq 0 then output three;
Data two; set two; drop Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9 insectno2;
Data two; set two;
	retain insectno2;
	if insectno2<1 then insectno2=0;
	insectno2=insectno2+1;
data three; set three;
var9=var8; var8=var7; var7=var6; var6=var5; var5=var4; var4=var3; var3=var2; var2=var1; var1=var1; /*Use "waveform;" in place of "var1;" to switch to TBF values.*/;
data three; set three; drop waveform insectno2;
data three; set three;
  retain insectno2;
  if insectno2<1 then insectno2=0;
  insectno2=insectno2+1;
data two; set two three; merge two three; by insectno2;
data two; set two; drop Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9;
%mend;

options ls=100 ps=72;

Data one;
      infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FB10" dsd missover;
      input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9;
Data one; Set one;
%Manip;
data two; set two; insectno="a10"; *C is the control group, T is the treatment group;
data four; set two;
Run;
/*
/******* This is the generic unit of this program.      ***********************
*****  For every individual there will be a separate file. *************************
*****  For every file there will be the following 8 lines of code. ******************
***** Copy and paste this section, changing filename and increment insectno by 1 ***
************************************************************************************/
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FB11" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="a11"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FB12" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="a12"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FB32" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="a32"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FB39" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="a39"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FB43" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="a43"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FB49" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="a49"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FB59" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="a59"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FB63" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="a63"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FB64" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="a64"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FB68" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="a68"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FB71" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="a71"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FB72" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="a72"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FB77" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="a77"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FB82" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="a82"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FB83" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="a83"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FB85" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="a85"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FB86" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="a86"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FB89" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="a89"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FB96" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="a96"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FB97" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="a97"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FB98" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="a98"; proc append base=four data=two; Run;

Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FG1" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="b01"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FG3" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="b03"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FG5" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="b05"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FG13" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="b13"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FG21" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="b21"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FG26" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="b26"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FG27" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="b27"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FG28" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="b28"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FG30" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="b30"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FG31" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="b31"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FG35" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="b35"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FG36" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="b36"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FG44" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="b44"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FG46" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="b46"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FG50" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="b50"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FG54" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="b54"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FG57" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="b57"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FG58" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="b58"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FG67" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="b67"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FG74" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="b74"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FG81" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="b81"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FG87" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="b87"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\FG95" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="b95"; proc append base=four data=two; Run;

Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MB2" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="c02"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MB4" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="c04"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MB6" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="c06"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MB8" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="c08"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MB15" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="c15"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MB16" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="c16"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MB18" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="c18"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MB19" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="c19"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MB20" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="c20"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MB22" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="c22"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MB23" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="c23"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MB29" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="c29"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MB37" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="c37"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MB38" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="c38"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MB40" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="c40"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MB41" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="c41"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MB42" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="c42"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MB45" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="c45"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MB47" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="c47"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MB48" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="c48"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MB51" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="c51"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MB61" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="c61"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MB76" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="c76"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MB99" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="c99"; proc append base=four data=two; Run;

Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MG7" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="d07"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MG9" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="d09"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MG14" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="d14"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MG24" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="d24"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MG25" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="d25"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MG33" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="d33"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MG34" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="d34"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MG52" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="d52"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MG56" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="d56"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MG60" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="d60"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MG62" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="d62"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MG66" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="d66"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MG69" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="d69"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MG75" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="d75"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MG78" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="d78"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MG80" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="d80"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MG84" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="d84"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MG88" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="d88"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MG93" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="d93"; proc append base=four data=two; Run;
Data one; infile "C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Data\MG100" dsd missover; input waveform$ Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9; Data one; Set one; %Manip; data two; set two; insectno="d10"; proc append base=four data=two; Run;
*NOTE: Insect d100 is insect d10;

**************************  End fundamental unit ************************************
**************** Paste one copy for each individual and make changes ****************
*************************************************************************************



************** Do not copy or paste anything below this line ************************
************************************ But ********************************************
************* Please change the file name in the Proc Export line *******************
******************  before running the program. Any old copy of  ********************
******************  this file will be replaced due to the "replace" statement *******
*************************************************************************************/;
data four; set four; waveform=compress(waveform);
Data four; set four;
	retain w0 w1 in0 marker1;
	w1=Compress(upcase(waveform));
	if insectno ne in0 then do;
	  w0='  ';
	  in0=insectno; marker1=0;
	end;
	Dur=var1-marker1;
	marker1=var1;
data four; set four; drop var1 w0 w1 in0 marker1;
proc sort; by insectno;
data five; set four; drop waveform dur insectno2;
proc sort; by insectno;
data five; set five four; merge five four; by insectno;
data five; set five; drop insectno2;
proc export data=five outfile="C:\Users\tebert\OneDrive - University of Florida\Work\Weight 2\Weight.csv" dbms=csv replace;
proc print data=five;
Run;
Quit;
